import { parseTime } from '@/utils'

import { mapGetters } from 'vuex'
export default {
    data() {
        return {
            cols: [{
                    key: 'name',
                    label: '试卷名称'
                },
                {
                    key: 'gradeLevel',
                    label: '级别'
                },
                {
                    key: 'paperType',
                    label: '试卷类型',
                    formatter: (row) => {
                        if (row.paperType) {
                            return this.paperTypeEnum[row.paperType]
                        }
                    }
                },
                {
                    key: 'score',
                    label: '分数'
                },
                {
                    key: 'questionCount',
                    label: '题目数量'
                },
                {
                    key: 'limitStartTime',
                    label: '开始时间',
                    formatter: (row) => {
                        if (row.limitEndTime) {
                            return parseTime(row.limitEndTime)
                        }
                    }
                },
                {
                    key: 'limitEndTime',
                    label: '结束时间',
                    formatter: (row) => {
                        if (row.limitEndTime) {
                            return parseTime(row.limitEndTime)
                        }
                    }
                },
                {
                    key: 'suggestTime',
                    label: '建议时长(分钟)'
                },
                {
                    key: 'subjectName',
                    label: '学科名'
                },
                {
                    key: 'createTime',
                    label: '创建时间',
                    formatter: (row) => {
                        if (row.createTime) {
                            return parseTime(row.createTime)
                        }
                    }
                }
            ],
            descritionCols: [{
                    key: 'name',
                    label: '试卷名称'
                },
                {
                    key: 'gradeLevel',
                    label: '级别',
                    type: 'select',
                    selectDataEnum: 'levelEnum'
                },
                {
                    key: 'paperType',
                    label: '试卷类型',
                    type: 'select',
                    selectDataEnum: 'paperTypeEnum'
                },
                {
                    key: 'limitStartTime',
                    label: '开始时间',
                    type: 'datetime'
                },
                {
                    key: 'limitEndTime',
                    label: '结束时间',
                    type: 'datetime'
                },
                {
                    key: 'suggestTime',
                    label: '建议时长(分钟)'
                },
                {
                    key: 'subjectId',
                    label: '学科名',
                    type: 'select',
                    selectDataEnum: 'subjectEnum'
                }
            ],
            titleCols: [
                { key: 'analyze', label: 'analyze' },
                { key: 'correct', label: 'correct' },
                { key: 'correctArray', label: 'correctArray' },
                { key: 'difficult', label: 'difficult' },
                { key: 'gradeLevel', label: 'gradeLevel' }
            ]
        }
    },
    computed: {
        ...mapGetters(['subjectEnum', 'paperTypeEnum'])
    }
}